#pragma once

/******************************************************/
/*
* filename:  FaceSdkForWin.h
*
* purpose:
*
* created:   2019/4/14 Friday 11:52  zyq
*
* Copyright (C) 2019  ZYTECHNOLOGY.
* All Rights Reserved.*/
/********************************************************/

#ifndef FACESDKFORWIN_H__2019_04_14__
#define FACESDKFORWIN_H__2019_04_14__
#define _Windows
#ifdef _Windows
#define FaceSDKForWin_EXPORTS
#ifdef FaceSDKForWin_EXPORTS
#define FaceSDKForWin_API __declspec(dllexport) __stdcall
#else
#define FaceSDKForWin_API __declspec(dllimport) __stdcall
#endif
#else
#define FaceSDKForWin_API
#endif

#define  FACEINFO_SIZE 21
#define FATURE_SIZE 512
#ifdef __cplusplus
extern "C" {
#endif
	/*
	The ZY_GetDevicesSerialNumber function will get the PC info and turn to EncryptionSerial,the EncryptionSerial
	must be given back to ZYTECHNOLOGY to get the decryptSerial code

	Parameters:
	EncryptionSerial[output],new [128] char* in
	mac[output],new [128] char* in
	cardstype[output] new [128] char* in
	error code:
	FACE_ERROR_SERAIL_P					-401
	FACE_SUCESS                 0
	Remarks:
	This function only can be called one time at program first used.
	
	*/
	int FaceSDKForWin_API ZY_GetDevicesSerialNumber(char*EncryptionSerial, char*mac, char *cardstype);

	/*
	The ZY_FaceSDKInit function will initialize the algorithm engine module
	must be given back to ZYTECHNOLOGY to get the decryptSerial code

	Parameters:
	nChannelNums[intput],algorithm channel nums,for multi-thread mode,one thread uses one channel
	decryptSerial[intput],the decryptSerial code get from ZYTECHNOLOGY
	error code:
	FACE_SUCESS                 0

	FACE_ERROR_INITFAILED      -1
	FACE_ERROR_MAXCHANNEL         -6
	FACE_REPEAT_INITFAILED      -9
	FACE_ERROR_SERAIL_P					-401
	FACE_ERROR_DECRYPT_P				-402
	FACE_ERROR_TIMEOUT					-403
	FACE_ERROR_LOCAL_DECRYPT_P			-404
	FACE_ERROR_LOCAL_DECRYPT_FILE_P      -405
	FACE_ERROR_COMPARE_DECRYPT_FILE_P    -406
	FACE_ERROR_NO_DECRYPT_P				-407
	Remarks:
	This function only can be called one time at  program initialization.
	*/
	int FaceSDKForWin_API ZY_FaceSDKInit(int nChannelNums, char*decryptSerial);

	/*
	The ZY_DetectAndExtract function execute face detection and get face feature.

	Parameters:
	pdata[input],image data buffer,RGB24 format.
	width[input],image width.
	height[input],image height.
	channel[input],bits per pixel(24-RGB24 image),must be 24
	pFea[output],the face feature..
	Return Values:
	If the function succeeds, the return value is FACE_SUCESS
	If the function fails, the return value is negative.
	error code:
	FACE_SUCESS                 0
	FACE_ERROR_INITFAILED      -1
	FACE_ERROR_MAXCHANNEL         -6
	FACE_REPEAT_INITFAILED      -9
	FACE_ERROR_SERAIL_P					-401
	FACE_ERROR_DECRYPT_P				-402
	FACE_ERROR_TIMEOUT					-403
	FACE_ERROR_LOCAL_DECRYPT_P			-404
	FACE_ERROR_LOCAL_DECRYPT_FILE_P      -405
	FACE_ERROR_COMPARE_DECRYPT_FILE_P    -406
	FACE_ERROR_NO_DECRYPT_P				-407
	Remarks:
	1.image data buffer(pImage)	size must be nWidth*(bpp/8)*nHeight.
	2.pFea must be allocated by caller,the memory size is FATURE_SIZE
	3.image data  have only have one face in
	*/
	int FaceSDKForWin_API ZY_DetectAndExtract( unsigned char* pdata, int width, int height, int channel, unsigned char* pFea);

	/*
	The ZY_FaceSDKRelease function will release the algorithm engine module
	Parameters:
	No parameter.
	Return Values:
	No return value.
	Remarks:
	This function only can be called one time at program exit.
	*/
	int FaceSDKForWin_API ZY_FaceSDKRelease();

	/****************************** face compara ****************************/
	/*
	The ZY_FFCompara function will compara face feature
	Parameters:
	pFeaA[in],the face A feature..
	pFeaB[in],the face B feature..
	Return Values:
	face Similarly belong 0.0 to 1.0  default threshold is 0.68
	Remarks:
	This function only can be called one time at program exit.
	*/
	float FaceSDKForWin_API ZY_FFCompara(unsigned char*feaA, unsigned char* feaB);
	/************************************************************************/

#ifdef __cplusplus
}
#endif

#endif
